const http = require("http");

http.createServer(function(req, res) {
    if (req.url.startsWith("/api/user") && req.method.toLowerCase() === "get") {
        res.writeHead(200, {
            "Content-Type": "text/plain; charset=utf-8"
        });
        res.end("这个是user");
    } else if (req.url.startsWith("/api/login") && req.method.toLowerCase() === "get") {
        res.writeHead(200, {
            "Content-Type": "text/plain; charset=utf-8"
        });
        res.end("这个是login");
    }
}).listen(80, '127.0.0.1', () => {
    console.log("服务已经启动");
});